#include<iostream>
#include<string>

class Student
{
public:
    Student(){}
    Student(int id,const std::string&name):id(id),name(name){}
    void show()
    {
        std::cout<<id<<" "<<name<<std::endl;
    }
    ~Student()
    {

    }
    static void print()//静态函数也可以继承
    {
        count++;
        std::cout<<"helloworld"<<std::endl;
    }


private:
    int id;
    std::string name;
public:
    static int count;
};
int Student::count=0;

class PrimaryStudent: public Student
{
public:
    PrimaryStudent():score(){}
    PrimaryStudent(int id,const std::string name,int score):Student( id, name),score(score)
    {
        
    }
    ~PrimaryStudent()
    {

    }
    //名词遮蔽：父类函数和子类函数同名，子类无法调用父类同名函数
    void show()
    {
        Student::show();//通过明确函数的域，来调用父类函数
        std::cout<<score<<std::endl;
    }


private:
    int score;//新定义的自己的属性
public:
    static int count;//父类的静态变量被遮蔽了
};

int PrimaryStudent::count=0;

int main()
{   Student s(1,"lisi");
    s.print();
    std::cout<<s.count<<std::endl;
    PrimaryStudent s1(1,"zhangsan",100);
    s1.print();
    std::cout<<s1.count<<std::endl;
    return 0;
}